<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@page contentType="text/html; charset=UTF-8"%>

<jsp:useBean id="user" class="model.User" scope="session" />

<html>
<head>
<meta http-equiv="Pragma" content="no-cache">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Dodavanje novog prevoznika</title>
</head>
<body>
<h1>Dodavanje novog prevoznika</h1>

<%
	if (user != null && user.isLoggedIn() || !user.isAdmin()) {
%>
<form action="/admin" method="get">
<table>
	<tr>
		<td align=right>username:</td>
		<td><input type="text" name="username"></td>
	</tr>
	<!-- 
	<tr>
		<td>&nbsp;</td>
		<td><small>voditi brigu o username</small></td>
	</tr> 
	-->

	<tr>
		<td align=right>password:</td>
		<td><input type="text" name="password"></td>
	</tr>

	<!--  dodajemo novi red -->
	<tr>
		<td>&nbsp;</td>
		<td>&nbsp;</td>
	</tr>

	<tr>
		<td align=right>Naziv:</td>
		<td><select name="ID">
			<c:forEach var="prev" items="${sessionScope.sviPrevoznici}">
				<option value="${prev.sifra.id}">${prev.naziv}</option>
			</c:forEach>
		</select>
		<br>
		<input type="text" name="noviNaziv">
		<input type="checkbox" name="novi" value="true" /> Dodaj novi					
		</td>
	</tr>
	
	<tr>
		<td align=right>Aliases:</td>
		<td><textarea name="aliases"></textarea></td>		
	</tr>

	<tr>
		<td align=right>Adresa:</td>
		<td><input type="text" name="adresa"></td>
	</tr>

	<tr>
		<td align=right>Email:</td>
		<td><input type="text" name="eMail"></td>
	</tr>

	<tr>
		<td align=right>Telefon:</td>
		<td><input type="text" name="telefon"></td>
	</tr>
	
	<tr>
		<td align="right">Vrsta prevoza:</td>
		<td><select name="vrstaPrevoza">
			<c:forEach var="vrsta" items="${sessionScope.vrstePrevoza}">
				<option value="${vrsta.sifra.id}">${vrsta.naziv}</option>
			</c:forEach>
		</select></td>
	</tr>
	
	<!--  dodajemo novi red -->
	<tr>
		<td>&nbsp;</td>
		<td>&nbsp;</td>
	</tr>
	
	<tr>
		<td><input type="hidden" name="addedNewCarrier" value="true"></td>
		<td><input type="submit" value="Dodaj"></td>
	</tr>
</table>

<br>
<br>

</form>
<%
	} else {
%>
<p>Niste se prijavili! <br>
<a href="/logIn">Prijavi se</a></p>
<%
	}
%>

<p><a href="/admin">Red voznje</a> <br>
<a href="/logIn?logOff=true">Odjava</a></p>

</body>
</html>
